package com.byteblogs.helloblog.dto;

import java.util.List;

/**
 * 用于向前端返回统一的结果对象
 *
 * @param <T>
 */
public class HttpResult<T> {

    private int success = 0; // 操作标识，标记
    private String resultCode; // 结果编码
    private String message; // 提示信息
    private T model; // 结果对象
    private List<T> models; // 结果集对象
    private PageInfo pageInfo; // 分页信息对象
    private Object extra; // 扩展字段

    public HttpResult() {
    }

    public int getSuccess() {
        return success;
    }

    public HttpResult<T> setSuccess(int success) {
        this.success = success;
        return this;
    }

    public String getResultCode() {
        return resultCode;
    }

    public HttpResult<T> setResultCode(String resultCode) {
        this.resultCode = resultCode;
        return this;
    }

    public String getMessage() {
        return message;
    }

    public HttpResult<T> setMessage(String message) {
        this.message = message;
        return this;
    }

    public T getModel() {
        return model;
    }

    public HttpResult<T> setModel(T model) {
        this.model = model;
        return this;
    }

    public List<T> getModels() {
        return models;
    }

    public HttpResult<T> setModels(List<T> models) {
        this.models = models;
        return this;
    }

    public PageInfo getPageInfo() {
        return pageInfo;
    }

    public HttpResult<T> setPageInfo(PageInfo pageInfo) {
        this.pageInfo = pageInfo;
        return this;
    }

    public Object getExtra() {
        return extra;
    }

    public HttpResult<T> setExtra(Object extra) {
        this.extra = extra;
        return this;
    }
}
